﻿//-----------------------------------------------------------------------
// <copyright file="IDependencyResolver.cs" company="deixei.com">
//     Copyright (c) deixei.com. All rights reserved.
// </copyright>
// <author>Marcio Parente</author>
//---------------------------------------------------------------------
namespace Deixei.Infrastructure
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Dependency resolver
    /// </summary>
    public interface IDependencyResolver
    {
        /// <summary>
        /// Register dependency
        /// </summary>
        /// <typeparam name="T">Type of an object</typeparam>
        /// <param name="instance">Instance of an object</param>
        void Register<T>(T instance);


        /// <summary>
        /// Registers the repository.
        /// </summary>
        /// <typeparam name="T">Repository Entity</typeparam>
        //void RegisterRepository<T>() where T : class;
                
        /// <summary>
        /// Registers the type helper.
        /// </summary>
        /// <typeparam name="T">Object to Register</typeparam>
        void RegisterTypeHelper<T>();

        /// <summary>
        /// Registers the type helper.
        /// </summary>
        /// <typeparam name="T">Interface to Register</typeparam>
        /// <typeparam name="Z">Object to Register</typeparam>
        void RegisterTypeHelper<T, Z>();

        /// <summary>
        /// Inject dependency
        /// </summary>
        /// <typeparam name="T">Type of an object</typeparam>
        /// <param name="existing">Type of an existing object</param>
        void Inject<T>(T existing);

        /// <summary>
        /// Resolve dependency
        /// </summary>
        /// <typeparam name="T">Type of an object</typeparam>
        /// <param name="type">Type of an object to resolve</param>
        /// <returns>Result of an object</returns>
        T Resolve<T>(Type type);

        /// <summary>
        /// Resolve dependency
        /// </summary>
        /// <typeparam name="T">Type of an object</typeparam>
        /// <param name="type">Type of an object to resolve</param>
        /// <param name="name">Name of an object</param>
        /// <returns>Result an object</returns>
        T Resolve<T>(Type type, string name);

        /// <summary>
        /// Resolve dependency
        /// </summary>
        /// <typeparam name="T">Type of an object</typeparam>
        /// <returns>Result an object</returns>
        T Resolve<T>();

        /// <summary>
        /// Resolve dependency
        /// </summary>
        /// <typeparam name="T">Type of an object</typeparam>
        /// <param name="name">Object Name</param>
        /// <returns>Result Type of an object</returns>
        T Resolve<T>(string name);

        /// <summary>
        /// Resolve all
        /// </summary>
        /// <typeparam name="T">Type of an object</typeparam>
        /// <returns>Enumerable of T</returns>
        IEnumerable<T> ResolveAll<T>();
    }
}
